<?php 
//更新统计商品分类缓存
$arrTypess = $db->fetch_all_assoc("select * from ".dbprefix."gift_type");
foreach($arrTypess as $key=>$item){
	$gift = $db->once_fetch_assoc("select count(giftid) from ".dbprefix."gift where typeid='".$item['typeid']."'");
	$arrTypes['list'][] = array(
		'typeid'	=> $item['typeid'],
		'typename'	=> $item['typename'],
		'count_gift'	=> $gift['count(giftid)'],
	);
}

$giftNum = $db->once_fetch_assoc("select count(giftid) from ".dbprefix."gift");
$arrTypes['count'] = $giftNum['count(giftid)'];

//生成缓存文件
fileWrite('gift_types.php','data',$arrTypes);

qiMsg("更新成功！");